package com.superm.service.impl;

import com.superm.entity.RolePermission;
import com.superm.mappers.RolePerMapper;
import com.superm.service.RolePerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(propagation = Propagation.REQUIRED)
public class RolePerServiceImpl implements RolePerService {
    @Autowired
    private RolePerMapper rolePerMapper;
    @Override
    public Integer addPer(Integer rid, List<RolePermission> rps) {
        rolePerMapper.delPer(rid);//根据id删除角色的权限信息
        Integer count = rolePerMapper.addPer(rid,rps);
        return count;
    }
    @Override
    public Integer delPers(List<String> rids) {
        return rolePerMapper.delPers(rids);
    }
}
